<?php



require_once "Common/database.php";
require_once "Common/values.php";

   $result = mysql_query("SELECT * FROM tblUsers WHERE Name='$user'");
   $row = mysql_fetch_array($result);
if($row[s]>0)
{

echo '<P><h3>Helpdesk Maintenance</h3>';

echo '<table border=1>';
echo '<tr>';



echo '<td><a href="index.php?p=shview&f2=status">Helpdesk Status</a></td>';
echo '<td><a href="index.php?p=shview&f2=Proirty">Proirty</a></td>';
echo '<td><a href="index.php?p=shview&f2=Projects">Projects</a></td>';
echo '<td><a href="index.php?p=shview&f2=Select">Select</a></td>';
echo '<td><a href="index.php?p=shview&f2=dSelect">Dashboard2 select</a></td>';
echo '<td><a href="index.php?p=shview&f2=branches">Branches</a></td>';
echo '<td><a href="index.php?p=shview&f2=folders">Folders</a></td>';
echo '<td><a href="index.php?p=shview&f2=kbfolders">KB Folders</a></td>';
echo '<td><a href="index.php?p=shview&f2=applications">Applications</a></td>';
echo '<td><a href="helpdesk/archive.php">Manual Archive</a></td>';
echo '<td><a href="index.php?p=retrieve">Retrieve from archive</a></td>';

echo '</tr></table>';



switch($_GET[f2])
{

case('status');
$result = mysql_query("SELECT * FROM tblstatus ORDER BY Line");
echo '<table border=1>';
echo '<tr><td>key</td><td>Line</td><td>Name</td><td>Project</td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form name="helpdeskadmin" action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST"><tr><td><input type=text name="key" value="'.$row['Key'].'">'.$row['key'].'</td><td><input type=text name="line" value="'.$row['Line'].'"></td><td><input type=text name="name" value="'.$row['Name'].'"></a></td><td><input type="text" name="project" value="'.$row[Project].'"></td><td><input type="checkbox" name="delete" value="checked"></td><td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('applications');
$result = mysql_query("SELECT * FROM tblapplications");

echo '<b>use this form to edit applications that appear in password reset form</b><p><table border=1>';
echo '<tr><td>ID</td><td>Name</td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form name="helpdeskadmin" action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST"><tr><td><input type=text name="id" value="'.$row['ID'].'"></td><td><input type=text name="name" value="'.$row['Name'].'"></a></td><td><input type="checkbox" name="delete" value="checked"></td><td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('Projects');
$result = mysql_query("SELECT * FROM tblprojects");
echo '<table border=1>';
echo '<tr><td>key</td><td>Name</td><td>Users</td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form name="helpdeskadmin" action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST">
<tr><td><input type=text name="key" value="'.$row['Key'].'">'.$row['key'].'</td><td><input type=text name="name" value="'.$row['Name'].'"></td><td><input type=text name="users" value="'.$row['Users'].'"></a></td><td><input type="checkbox" name="delete" value="checked"></td><td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('folders');
$result = mysql_query("SELECT * FROM tblFolders Order By `key`");
echo '<table border=1>';
echo '<tr><td>key</td><td>Name</td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST"><tr><td><input type=text name="key" value="'.$row['key'].'"></td><td><input type=text name="name" value="'.$row['Folder'].'"></a></td><td><input type="checkbox" name="delete" value="checked"></td><td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('kbfolders');
$result = mysql_query("SELECT * FROM tblkbfolders Order By `ID`");
echo '<table border=1>';
echo '<tr><td>key</td><td>Name</td><td>Users</td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST"><tr><td><input type=text name="key" value="'.$row['ID'].'"></td><td><input type=text name="name" value="'.$row['Folder'].'"></td><td><input type=text name="users" value="'.$row['Users'].'"></td><td><input type="checkbox" name="delete" value="checked"></td><td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('Proirty');
$result = mysql_query("SELECT * FROM tblProirty");
echo '<table border=1>';
echo '<tr><td>key</td><td>Name</td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST"><tr><td><input type=text name="key" value="'.$row['Key'].'">'.$row['key'].'</td><td><input type=text name="name" value="'.$row['Name'].'"></a></td><td><input type="checkbox" name="delete" value="checked"></td><td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('Select');
$result = mysql_query("SELECT * FROM tblSelect");
echo '<table border=1>';
echo '<tr><td>Select</td><td></td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST">
<tr><td><input type=text name="select" value="'.$row['Select'].'">'.'</td>
<td><a href="index.php?p=shviews&s='.$row[Select].'">Edit</a></td>
<td><input type="checkbox" name="delete" value="checked"></td>
<td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('branches');
$result = mysql_query("SELECT * FROM tblbranches ORDER BY ID");
echo '<table border=1>';
echo '<tr><td>key</td><td>Branch Number</td><td>Branch Name</td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST"><tr><td><input type=text name="id" value="'.$row['ID'].'"></td><td><input type=text name="number" value='.$row['BranchNumber'].'></a></td><td><input type=text name="name" value="'.$row['BranchName'].'"></a></<td><td><input type="checkbox" name="delete" value="checked"></td><td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('dSelect');
$result = mysql_query("SELECT * FROM tbldashboard2");
echo '<table border=1>';
echo '<tr><td>Select</td><td></td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form action="system/helpdesk/uinsert.php?f2='.$_GET[f2].'" method="POST">
<tr><td><input type=text name="select" value="'.$row['Select'].'">'.'</td>
<td><a href="index.php?p=sdhviews&s='.$row[Select].'">Edit</a></td>
<td><input type="checkbox" name="delete" value="checked"></td>
<td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;


}
}
else
{
    echo '<h3>Access Denided</h3>';
}


?>